package com.liaozl.sca.account.sentinel;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.liaozl.sca.common.dto.Result;
import com.liaozl.sca.common.enums.ResultCodeEnum;
import lombok.extern.slf4j.Slf4j;

/**
 * @Description:
 * @version: v1.0.0
 * @author: liaozuliang
 * @date: 2021/9/18 11:40
 */
@Slf4j
public class SentinelBlockHandler {

    public static Result defaultHandler(BlockException exception) {
        log.error("请求过快拉，defaultHandler:", exception);
        return Result.failed(ResultCodeEnum.REQUEST_FAST);
    }

    public static Result getByUserIdHandler(Long userId, BlockException exception) {
        log.error("请求过快拉，getByUserIdHandler:", exception);
        return Result.failed(ResultCodeEnum.REQUEST_FAST);
    }

}
